Component({
  options: {
    addGlobalClass: true
  },
  properties: {
    todayCourse: {
      type: null,
      value: ''
    },
    currentWeek: {
      type: Number,
      value: ''
    },
    sectionIndex: {
      type: Array,
      value: ''
    }
  },

  data: {
    month: new Date().getMonth() + 1, // 月份
    date: new Date().getDate(), // 日期
    weekday: ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
    today: new Date().getDay() //星期
  },

  lifetimes: {
    attached: function () {
      let sections = [];
      for (let i = 0; i < (this.data.sectionIndex.reduce((x, y) => x + y) + 3); i++) {
        sections.push(i + 1);
      }
      this.setData({ sections });
    },
    detached: function () {
    },
  },
  observers: {
    'currentWeek'(e) {
      var week = `第${e}周`;;
      if (e <= 0 || e >= 21) week = '假期中';
      this.setData({ week });
    }
  },
  methods: {
  }
})